package com.bmslz.monitor.base.dto;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bmslz.monitor.base.util.StringUtils;
import com.bmslz.monitor.base.entity.Project;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Description: 监控项目列表搜索入参
 * @Author: bobo
 * @Date: 2025-08-10
 * @Version: V1.0
 */
@Data
public class ProjectSearchDto {
    /**
     * 项目编号
     */
    @ApiModelProperty(value = "项目编号")
    private String projectNo;
    /**
     * 项目名称
     */
    @ApiModelProperty(value = "项目名称")
    private String projectName;
    /**
     * 1 在线 0 离线
     */
    @ApiModelProperty(value = "1 在线 0 离线")
    private String online;

    public LambdaQueryWrapper<Project> wrapper() {
        LambdaQueryWrapper<Project> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(StringUtils.isNotEmpty(projectName), Project::getProjectName, projectName);
        wrapper.like(StringUtils.isNotEmpty(projectNo), Project::getProjectNo, projectNo);
        wrapper.eq(StringUtils.isNotEmpty(online), Project::getOnline, online);
        return wrapper;
    }
}
